package com.cooldatasoft.domain.daoImpl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.cooldatasoft.domain.dao.RolesDao;
import com.cooldatasoft.domain.model.Roles;

public class RolesDaoImpl extends GenericDaoImpl<Roles, Long> implements RolesDao {

	@SuppressWarnings("unchecked")
	@Override
	public Roles getRoleById(Long id) {
		Criteria reservationCrit = getSession().createCriteria(Roles.class);
		reservationCrit.add(Restrictions.eq("idRole", id));
		
		List<Roles> res = reservationCrit.list();
		return (res.size() > 0) ? res.get(0) : null;
	}

}
